<%-- 
    Document   : warehouses
    Created on : Nov 6, 2009, 1:18:13 AM
    Author     : moustafa
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList" %>
<%@page import="java.util.Iterator" %>
<%@page import="model.Warehouse" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Warehouses</title>
    </head>
    <body>
        <table border="1" cellspacing="1" cellpadding="1">
            <thead>
                <tr>
                    <th>Warehouse Name</th>
                    <th>Warehouse Location</th>
                    <th>Edit Warehouse</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <%
                ArrayList <Warehouse> warehouses = (ArrayList <Warehouse>)request.getSession(false).getAttribute("warehouses");
                Iterator warehousesItr = warehouses.iterator();
                while(warehousesItr.hasNext()){
                Warehouse warehouse = (Warehouse)warehousesItr.next();
                 %>
                 
                 <%=
                 "<tr>"+
                    "<td>" + warehouse.getName() + "</td>"+
                    "<td>" + warehouse.getLocation() + "</td>"+
                    "<td align='center'>" +
                    "<form action='../admin_pages/edit_warehouse.jsp' method='POST'>" +
                    "<input type='hidden' name='warehouse_id' value='" + warehouse.getID() + "'/>" +
                    "<input type='hidden' name='warehouse_name' value='" + warehouse.getName() + "'/>" +
                    "<input type='hidden' name='warehouse_location' value='" + warehouse.getLocation() + "'/>" +
                    "<input type='submit' value='Edit'/>" +
                    "</form>" +
                    "</td>"+
                 "</tr>"
                 %>
                 <%
                 }
                 %>
            </tbody>
        </table>
            <form action="/oes/admin_pages/add_warehouse.jsp">
                <input type="submit" value="Add Warehouse" />
            </form>
    </body>
</html>
